/*
* Created by: yyf
* Description: 基金管理--拟设立基金--基金详情
*/
<template>
    <div class="ca-box-border-top-none headTitle">
        <div v-if="!isEdit">
            <el-row>
                <el-col :span="20" class="ca-title ca-m-b-20">
                    <h3>基本信息</h3>
                </el-col>
                <el-col :span="4" class="pull-right ca-align-right">
                    <el-button type="text" class="ca-edit-btn el-icon-edit" @click="changeEdit(true)" :disabled="!isAuthDetailEdit">编辑</el-button>
                </el-col>
            </el-row>
            <el-form class="ca-p-l-20 ca-p-r-20" label-width="120px" :model="fundDetail">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="基金委派代表：" class="wordWrap">{{fundDetail.fundDelegate}}</el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="基金托管人：" class="wordWrap">{{fundDetail.custodian}}</el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="注册地：" class="wordWrap">{{fundDetail.place}}</el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="办公地：" class="wordWrap">{{fundDetail.officeLand}}</el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-form-item label="管理费：" class="wordWrap">{{fundDetail.proportion}}</el-form-item>
                </el-row>
                <el-row>
                    <el-form-item label="业务报酬：" class="wordWrap">{{fundDetail.achievement}}</el-form-item>
                </el-row>
                <el-row>
                    <el-form-item label="其他：" class="wordWrap">{{fundDetail.other}}</el-form-item>
                </el-row>
            </el-form>
        </div>
        <csEstablishingFundDetailsEdit
            @changeEdit="changeEdit"
            @addRedDot="addRedDot"
            :fundDetail="fundDetail"
            v-if="isEdit">
        </csEstablishingFundDetailsEdit>
    </div>
</template>
<script type="text/ecmascript-6">
    import {api} from '../api';
    import {STATUS_HTTP_SUCCESS, apiHttp} from '__service/csHttp';
    import { isNoAuth } from '__service/utils';
    export default {
        data() {
            return {
                isAuthEdit: false,
                isEdit: false,
                fundDetail: {},
                isAuthDetailEdit: isNoAuth('拟设立基金-基金详情-编辑'),
            }
        },
        props: {
        },
        mounted() {
            this.fundId = this.$route.params.itemId;
            this.getFundDetails();
        },
        methods: {
            addRedDot() {
                this.$emit('addRedDot', 0);
            },
            // 进入编辑页
            changeEdit(val) {
                this.isEdit = val;
                if (val === false) {
                    this.getFundDetails();
                }
            },
            // 获取详情数据
            async getFundDetails() {
                let {resCode, data} = await apiHttp(api.ESTABLISHING_FUNDS_DETAILS, {fundId: this.fundId});
                if (resCode === STATUS_HTTP_SUCCESS) {
                    this.fundDetail = data;
                }
            },
        },
        components: {
            'csEstablishingFundDetailsEdit': require('./edit'),//基金详情编辑
        }
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
    .headTitle{
        font-size:16px;
        padding: 20px;
    }
    .wordWrap{
        word-break: break-all;
    }
</style>
